package buco.jsonrpc;

import java.io.IOException;
import java.io.Writer;

import org.json.simple.*;

import buco.core.api.*;

public class ExportPackageCapabilityConverter implements JSONStreamAware {
	private ExportPackageCapability capability; 
	
	public ExportPackageCapabilityConverter(ExportPackageCapability capability) {
		this.capability = capability; 
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public void writeJSONString(Writer wr) throws IOException {
		JSONObject jsonCap = new JSONObject(); 
		jsonCap.put("type", ExportPackageCapability.class.getSimpleName());
		jsonCap.put("packageName", capability.getPackageName());
		if(capability.getPackageVersion() != null) {
			jsonCap.put("packageVersion", capability.getPackageVersion().toString());
		}
		jsonCap.writeJSONString(wr); 

	}

}
